Skip to content

test: stop the oversized-file guard test writing 31 MB for real - #268

Open
ankitranjan7 wants to merge 1 commit into
mainfrom
fix/flaky-oversized-file-test
Open

test: stop the oversized-file guard test writing 31 MB for real#268
ankitranjan7 wants to merge 1 commit into
mainfrom
fix/flaky-oversized-file-test

Conversation

@ankitranjan7

@ankitranjan7 ankitranjan7 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Fixes the Windows CI flake seen on #267. No issue filed.

The problem

A test wrote a real 31 MB file to disk just to have something bigger than sendWithFile's 30 MB limit. On a slow Windows runner that write alone can exceed the 5-second default timeout:

FAIL  plugin  plugins/claude/test/utils.test.js > claude sendWithFile > rejects oversized files before any upload attempt
Error: Test timed out in 5000ms.

It is a flake, not a regression: commit 4eb9c549 failed this job in its push run (31402668177) and passed the same job in its pull_request run (31402676413).

What I changed

plugins/claude/test/utils.test.js — the size guard only reads stats.size (plugins/claude/utils.js:378), so the test now truncates an empty file to 31 MB instead of writing 31 MB of data. Same assertion, no bulk write.

Proof

npx vitest run plugins/claude/test/utils.test.js → 12 passed, test time 5 ms (previously dominated by the write). The /too large/ assertion still fires, so the file really is over the limit.

🤖 Generated with Claude Code

The test allocated and wrote a real 31 MB buffer to a temp dir just to give
the size guard something over its 30 MB limit. On Windows CI that write alone
can exceed the 5s default timeout — it failed the push run of 4eb9c54 while
the identical pull_request run passed.

The guard only reads stats.size, so truncate an empty file to the same length
instead: same assertion, sparse file, no bulk write.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🟢 No documentation gap found — high confidence

The pull request only changes tests, lockfiles, generated metadata, or dependency metadata.

This review is advisory and does not block merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant